﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KPIS.GERP.GBMS.APP_UI.UserControls
{
    public partial class _Test3 : System.Web.UI.UserControl
    {
        public _Test3()
        {

        }

        public int? Record_Seq
        {
            get
            {
                int result;
                Int32.TryParse(lblid.Text, out result);
                return result;
            }
            set
            {
                lblid.Text = Convert.ToString(value);
                if (String.IsNullOrEmpty(lblid.Text))
                    lblid.Text = "Not defined";
            }
        }
        public string Name
        {
            get { return lblName.Text; }
            set { lblName.Text = value; }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

                RadGrid1.DataSource = GetSampleDataSource();
            } catch (Exception er)
            {
            }
        }

        private object GetSampleDataSource()
        {
            return new List<ObjectTest>
                       {
                           new ObjectTest
                               {
                                   ID = 1,
                                   FirstName = "นาย A",
                                   LastName = "กลมกลืน"
                               },
                           new ObjectTest
                               {
                                   ID = 2,
                                   FirstName = "นาย B",
                                   LastName = "กลมกล่อม"
                               }
                       };
        }
    }
    public class ObjectTest
    {
        public int ID { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
}